import http from "@/utils/request";

export const getWarehouse = (params) => {
  //返回仓库列表
  return http.get("/warehouse/page", {
    params: {
      type: params.type,
      curPage: params.curPage,
      limit: params.limit,
      sname: params.sname,
    },
  });
};

export const getSupplier = (params) => {
  //返回供应商列表
  return http.get("/supplier/list");
};

export const whPrchsAdd = (data) => {
  //增加仓库信息
  return http.post("/whPrchs/addWhPrchs", data);
};
export const editWarehouse = (data) => {
  //更新仓库信息
  return http.post("/warehouse/editWarehouse", data);
};
export const delWarehouse = (param) => {
  //删除仓库信息
  const myparams = new URLSearchParams();
  myparams.append("wid", param);
  return http.post("/warehouse/delWarehouse", myparams);
};

export const getStockAndStatusByDrugId = (params) => {
  //返回单个药品的库存
  return http.get("/warehouse/getStockAndStateByDrugId", {
    params: {
      did: params.did,
    },
  });
};

export const submitDrugProblem = (data) => {
  //提交问题药品信息
  return http.post("/warehouse/submitDrugProblem", data);
};

export const getSaleDrugList = (params) => {
  //返回供应商列表
  return http.get("/warehouse/getSaleDrugList");
};
export const getGoodPriceByDrugId = (params) => {
  //返回商品售价
  return http.get("/warehouse/getGoodPriceByDrugId", {
    params: {
      did: params.did,
    },
  });
};
